import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MaterialModelInfoVO, MaterialModelInfoForm, MaterialModelInfoQuery } from '@/api/material/materialModelInfo/types';

/**
 * 查询物料型号列表
 * @param query
 * @returns {*}
 */

export const listMaterialModelInfo = (query?: MaterialModelInfoQuery): AxiosPromise<MaterialModelInfoVO[]> => {
  return request({
    url: '/material/materialModelInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询物料型号详细
 * @param id
 */
export const getMaterialModelInfo = (id: string | number): AxiosPromise<MaterialModelInfoVO> => {
  return request({
    url: '/material/materialModelInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增物料型号
 * @param data
 */
export const addMaterialModelInfo = (data: MaterialModelInfoForm) => {
  return request({
    url: '/material/materialModelInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改物料型号
 * @param data
 */
export const updateMaterialModelInfo = (data: MaterialModelInfoForm) => {
  return request({
    url: '/material/materialModelInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除物料型号
 * @param id
 */
export const delMaterialModelInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/material/materialModelInfo/' + id,
    method: 'delete'
  });
};
